define(function (require, exports, module) {
    'use strict';
    var base = require('js/utils/model'),
        _ = require('underscore');
    exports.Account = base.Model.extend({
        defaults: {
            id: 0,
            avatar_id: "",
            country: "cn",
            created_at: "",
            updated_at: "",
            phone: "",
            alipay: "",
            bank_card: "",
            wechat: "",
            nick_name: "",
            ip: "",
            addr: "",
            is_virtual: false,
            balance: 0,
            active_days: 0,
            user_stats: {
                chn: "none",
                aid: "none",
                pay: {
                    total: 0,
                    count: 0
                },
                win: {
                    total: 0,
                    count: 0
                },
                recharge: {
                    total: 0
                },
                lottery: {}
            },
            daily_stats: {
                pay: {
                    total: 0,
                    count: 0
                },
                win: {
                    total: 0,
                    count: 0
                },
                recharge: {
                    total: 0,
                    count: 0
                },
                lottery: {}
            }
        },
        urlRoot: "/admin/account/",
    });
    exports.AccountCoupon = base.Model.extend({
        defaults: {
            user_id: 0,
            coupon_type: 1,
            title: '',
            desc: '',
            price: 0,
            condition_price: 0,
            status: '',
            start_ts: '',
            expire_ts: '',
        },
        initialize: function () {
            this.user_id = 1;
        },
        urlRoot: function () {
            return "/admin/" + this.user_id + '/coupon/';
        },
    });
    exports.AccountCouponCollection = base.Collection.extend({
        model: exports.AccountCoupon,
        initialize: function (options) {
            this.user_id = options.user_id;
        },
        url: function () {
            return "/admin/account/" + this.user_id + '/coupon/';
        },
        total: 0,
        stats: {},
        parse: function (response) {
            if (!response.data) {
                return [];
            }
            this.total = response.data.total_count;
            var list = response.data.list || [];
            this.stats = response.data.stats;
            return list;
        }
    });
    exports.AccountTransaction = base.Model.extend({
        defaults: {
            user_id: '',
            type: '',
            title: '',
            price: 0,
            balance: 0.0,
            order_id: '',
            extend: {},
            created_at: '',
            updated_at: '',
            pay_id: '',
            status: '',
            name: ''
        },
        url: function () {
            return "/admin/account/" + this.user_id + '/transaction/';
        },
    });
    exports.AccountTransactionCollection = base.Collection.extend({
        model: exports.AccountTransaction,
        initialize: function (options) {
            this.user_id = options.user_id;
        },
        url: function () {
            return "/admin/account/" + this.user_id + "/transaction/";
        },
        titles: '',
        parse: function (response) {
            if (!response.data) {
                return [];
            }
            this.total = response.data.total_count;
            this.total_outcome = response.data.total_outcome;
            this.total_income = response.data.total_income;
            this.titles = response.data.titles;
            var list = response.data.list || [];
            return list;
        }
    });
    exports.Pay = base.Model.extend({
        defaults: {
            id: '',
            user_id: 0,
            pay_type: 0,
            status: 2,
            price: 0,
            activity_id: 0,
            activity_name: '',
            user_type: 0,
            created_at: '',
            updated_at: '',
        },
        urlRoot: "/admin/stats/pay/",
    });
    exports.PayCollection = base.Collection.extend({
        model: exports.Pay,
        url: "/admin/stats/pay/",
    });
    exports.Uninstall = base.Model.extend({
        defaults: {
            _id: '',
            total_pay: '',
            uid: '',
            type: '',
            run_count: '',
            created_at: '',
            remove_at: '',
            reason: []
        },
        urlRoot: '/admin/feedback/uninstall/',
    });
    exports.UninstallCollection = base.Collection.extend({
        model: exports.Uninstall,
        url: '/admin/feedback/uninstall/',
    });
    exports.FeedBack = base.Model.extend({
        defaults: {
            id: '',
            user_id: '',
            'nick_name': '',
            'qq': '',
            'content': '',
            'chn': '',
            'cvc': ''
        },
        urlRoot: '/admin/feedback/',
    });
    exports.FeedBackCollection = base.Collection.extend({
        model: exports.FeedBack,
        url: '/admin/feedback/'
    });
    exports.Order = base.Model.extend({
        defaults: {
            user_id: '',
            activity_type: 1,
            order_id: 1,
            status: 0,
            detail: {},
            created_at: '',
            updated_at: ''
        },
        urlRoot: "/admin/order/"
    });
    exports.OrderCollection = base.Collection.extend({
        model: exports.Order,
        url: '/admin/order/'
    });
    exports.AccountLogin = base.Model.extend({
        defaults: {},
        urlRoot: '/admin/account/chn_ip/'
    });
    exports.AccountLoginCollection = base.Collection.extend({
        model: exports.AccountLogin,
        url: '/admin/account/chn_ip/'
    });

    exports.RechargeOrder = base.Model.extend({
        defaults: {},
        urlRoot: '/admin/stats/pay_by_user_id/'
    });
    exports.RechargeOrderCollection = base.Collection.extend({
        model: exports.RechargeOrder,
        url: '/admin/stats/pay_by_user_id/'
    });
});


